home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
ab20
/
ab20_archive
/
graphics
/
blankers
/
shadowmaster.lzh
/
source
/
savers
/
black.c
next >
Wrap
C/C++ Source or Header
|
1991-12-03
|
4KB
|
126 lines
/*
* A template for use in building new saver graphics.
*
* Copyright 1991, Mike Meyer
* All Rights Reserved
*
* See the file "ShadowMaster:Distribution" for information on distribution.
*
* ===build instructions
* % lc -dNORAND black ; output= black.o input= black.c savermain.h
* % blink black.o SC SD ; output= black input= black.o
* % copy black //savers
* ===endbuild
*
* Change the screen title, tags and colorspec to suit you, replace the
* (trivial) dographics fuction at the bottom with code to do your
* graphics. It'll be called with the Intuition and Graphics libraries
* already open, and window and screen open on the stuff you chose.
* Check SIGBREAKF_CTRL_C at regular intervals, and clean up after
* yourself and exit when you get it. Return and everything else will be
* cleaned up and the program will exit.
*
* Compile this with large data mode and stack checking off. Use -dNORAND
* if you don't need the random number generator (rand) intialized.
*/
#include <exec/types.h>
#include <intuition/intuition.h>
#include <graphics/gfx.h>
#include <dos/dos.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/graphics.h>
#include <proto/intuition.h>
#ifndef NORAND /* So we error out if we did a NORAND but use it */
int rand(void) ;
void srand(int) ;
#endif
static void dographics(void) ;
struct ExecBase *SysBase = NULL ;
struct DosLibrary *DOSBase = NULL ;
struct IntuitionBase *IntuitionBase = NULL ;
struct GfxBase *GfxBase = NULL ;
struct Screen *screen = NULL ;
struct Window *window = NULL ;
/* Don't change anything above this point... */
/*
* This is the initial color table for the blanker screen. The format of a
* ColorSpec is pen number, R, G, B. Add pens as required by your screen. You
* should really set all pens, so you avoid color flashes after opening.
* If you insist on doing it another way, add SA_ScreenBehind to the screen
* and do a ScreenToFront after setting the colormap, but before you start
* drawing.
*
* Don't forget to set the SA_Depth tag in ScreenTags...
*/
static struct ColorSpec colorspec[] = {
{0, 0, 0, 0},
{1, 8, 8, 8},
{ -1 } } ;
/*
* You must have a better name to use here, right?
*/
static char *Title = "Trivial Screen Blanker" ;
/*
* Screen open data. You'll probably want to change this to set your own
* depth and mode. I'd recommend leaving the overscan as is, but it's your
* graphics hack.
*/
static struct TagItem ScreenTags[] = {
{SA_Depth, 1},
{SA_Colors, &colorspec},
{SA_DisplayID, LORES_KEY},
{SA_Overscan, OSCAN_MAX},
{SA_Title, &Title},
{SA_ShowTitle, FALSE},
{SA_Quiet, TRUE},
{TAG_END, 0}
} ;
/*
* The window is for turning off the sprite, and that's about it. However,
* if you want clipped rendering (which means part of your graphics aren't
* going to be seen), you can use it's rastport. Until you're sure that's
* not going on, you probably want to do that anyway. After you trust your
* grahics code, render through the screen rastport to get extra speed.
*
* WARNING: WA_CustomScreen _MUST_ be the first entry!!!
*/
static struct TagItem WindowTags[] = {
{WA_CustomScreen, 0},
{WA_Borderless, TRUE},
{WA_Activate, TRUE},
{WA_SimpleRefresh, TRUE},
{TAG_END, 0}
};
#include "savermain.h"
/*
* Add whatever graphics you want here. Be sure and do a
* CheckSignal(SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C at regular intervals, as
* that's how you're told to unblank. When that evaluates to true, you should
* free everything you've allocated and return.
*
* Note that we seed the rand() number generator in _main, so that it can
* happen before we drop the task priority. For saver hacks, that random
* number generator should be good enough. If you need better, change that
* seeding. Otherwise, you can just use rand() knowing you'll get different
* sequences each time you get started. If you really don't want this, just
* delete the stuff in main.
*
* This example doesn't _do_ anything, so it uses a Wait instead of checking
* signals. We want to be a good citizen.
*/
static void
dographics(void) {
Wait(SIGBREAKF_CTRL_C) ;
}